package tech.dx.springdb.respository;


import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import tech.dx.springdb.entity.User;

import java.util.Optional;


public interface UserRepository extends JpaRepository<User,Long>{

    /**
     *
     * @param email
     * @return
     */
   Optional<User> findUserByEmail(String email);

   @Modifying
   @Query("update User u set u.status= '0' where u.id = ?1")
   void   deleteUserById(int id);
}
